<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Numeric</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            Numeric 
            
                <span class="parent">&lt; 
                    
                    <a href="Object.html">Object</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/numeric/bytes_rb.html">activesupport/lib/active_support/core_ext/numeric/bytes.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/numeric/conversions_rb.html">activesupport/lib/active_support/core_ext/numeric/conversions.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/numeric/time_rb.html">activesupport/lib/active_support/core_ext/numeric/time.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/blank_rb.html">activesupport/lib/active_support/core_ext/object/blank.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/duplicable_rb.html">activesupport/lib/active_support/core_ext/object/duplicable.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/string/output_safety_rb.html">activesupport/lib/active_support/core_ext/string/output_safety.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/json/encoding_rb.html">activesupport/lib/active_support/json/encoding.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>A</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-ago">ago</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>B</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-byte">byte</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-bytes">bytes</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-day">day</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-days">days</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-duplicable-3F">duplicable?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>E</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-exabyte">exabyte</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-exabytes">exabytes</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>F</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-fortnight">fortnight</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-fortnights">fortnights</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-from_now">from_now</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>G</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-gigabyte">gigabyte</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-gigabytes">gigabytes</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>H</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-hour">hour</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-hours">hours</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-html_safe-3F">html_safe?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>K</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-kilobyte">kilobyte</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-kilobytes">kilobytes</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>M</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-megabyte">megabyte</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-megabytes">megabytes</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-minute">minute</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-minutes">minutes</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>P</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-petabyte">petabyte</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-petabytes">petabytes</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>S</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-second">second</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-seconds">seconds</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-since">since</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-terabyte">terabyte</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-terabytes">terabytes</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-to_formatted_s">to_formatted_s</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>U</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-until">until</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>W</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Numeric.html#method-i-week">week</a>,
              </li>
            
              
              <li>
                <a href="Numeric.html#method-i-weeks">weeks</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    
      <!-- Section constants -->
      <div class="sectiontitle">Constants</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class="attr-name">KILOBYTE</td>
            <td>=</td>
            <td class="attr-value">1024</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">MEGABYTE</td>
            <td>=</td>
            <td class="attr-value">KILOBYTE * 1024</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">GIGABYTE</td>
            <td>=</td>
            <td class="attr-value">MEGABYTE * 1024</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">TERABYTE</td>
            <td>=</td>
            <td class="attr-value">GIGABYTE * 1024</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">PETABYTE</td>
            <td>=</td>
            <td class="attr-value">TERABYTE * 1024</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">EXABYTE</td>
            <td>=</td>
            <td class="attr-value">PETABYTE * 1024</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
      </table>
    


    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-ago">
            
              <b>ago</b>(time = ::Time.current)
            
            <a href="Numeric.html#method-i-ago" name="method-i-ago" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Reads best without arguments:  10.minutes.ago</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-until">until</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-ago_source')" id="l_method-i-ago_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/numeric/time.rb#L65" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-ago_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/time.rb, line 65</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">ago</span>(<span class="ruby-identifier">time</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">current</span>)
  <span class="ruby-identifier">time</span> <span class="ruby-operator">-</span> <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-byte">
            
              <b>byte</b>()
            
            <a href="Numeric.html#method-i-byte" name="method-i-byte" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-bytes">
            
              <b>bytes</b>()
            
            <a href="Numeric.html#method-i-bytes" name="method-i-bytes" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Enables the use of byte calculations and declarations, like 45.bytes +
2.6.megabytes</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-byte">byte</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-bytes_source')" id="l_method-i-bytes_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9eeb5fed2ff8e781e56202f62b125bfadc486999/activesupport/lib/active_support/core_ext/numeric/bytes.rb#L10" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-bytes_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 10</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">bytes</span>
  <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-day">
            
              <b>day</b>()
            
            <a href="Numeric.html#method-i-day" name="method-i-day" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-days">
            
              <b>days</b>()
            
            <a href="Numeric.html#method-i-days" name="method-i-days" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-day">day</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-days_source')" id="l_method-i-days_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/numeric/time.rb#L49" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-days_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/time.rb, line 49</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">days</span>
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Duration</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span> * <span class="ruby-number">24</span>.<span class="ruby-identifier">hours</span>, [[<span class="ruby-value">:days</span>, <span class="ruby-keyword">self</span>]])
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-duplicable-3F">
            
              <b>duplicable?</b>()
            
            <a href="Numeric.html#method-i-duplicable-3F" name="method-i-duplicable-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Numbers are not duplicable:</p>

<pre class="ruby"><span class="ruby-value">3</span>.<span class="ruby-identifier">duplicable?</span> <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-value">3</span>.<span class="ruby-identifier">dup</span>         <span class="ruby-comment"># =&gt; TypeError: can't dup Fixnum</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-duplicable-3F_source')" id="l_method-i-duplicable-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/object/duplicable.rb#L74" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-duplicable-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/duplicable.rb, line 74</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">duplicable?</span>
  <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-exabyte">
            
              <b>exabyte</b>()
            
            <a href="Numeric.html#method-i-exabyte" name="method-i-exabyte" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-exabytes">
            
              <b>exabytes</b>()
            
            <a href="Numeric.html#method-i-exabytes" name="method-i-exabytes" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-exabyte">exabyte</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-exabytes_source')" id="l_method-i-exabytes_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9eeb5fed2ff8e781e56202f62b125bfadc486999/activesupport/lib/active_support/core_ext/numeric/bytes.rb#L40" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-exabytes_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 40</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">exabytes</span>
  <span class="ruby-keyword">self</span> * <span class="ruby-constant">EXABYTE</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-fortnight">
            
              <b>fortnight</b>()
            
            <a href="Numeric.html#method-i-fortnight" name="method-i-fortnight" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-fortnights">
            
              <b>fortnights</b>()
            
            <a href="Numeric.html#method-i-fortnights" name="method-i-fortnights" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-fortnight">fortnight</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-fortnights_source')" id="l_method-i-fortnights_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/numeric/time.rb#L59" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-fortnights_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/time.rb, line 59</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">fortnights</span>
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Duration</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span> * <span class="ruby-number">2</span>.<span class="ruby-identifier">weeks</span>, [[<span class="ruby-value">:days</span>, <span class="ruby-keyword">self</span> * <span class="ruby-number">14</span>]])
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-from_now">
            
              <b>from_now</b>(time = ::Time.current)
            
            <a href="Numeric.html#method-i-from_now" name="method-i-from_now" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Reads best without arguments:  10.minutes.from_now</p>
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-gigabyte">
            
              <b>gigabyte</b>()
            
            <a href="Numeric.html#method-i-gigabyte" name="method-i-gigabyte" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-gigabytes">
            
              <b>gigabytes</b>()
            
            <a href="Numeric.html#method-i-gigabytes" name="method-i-gigabytes" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-gigabyte">gigabyte</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-gigabytes_source')" id="l_method-i-gigabytes_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9eeb5fed2ff8e781e56202f62b125bfadc486999/activesupport/lib/active_support/core_ext/numeric/bytes.rb#L25" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-gigabytes_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 25</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">gigabytes</span>
  <span class="ruby-keyword">self</span> * <span class="ruby-constant">GIGABYTE</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-hour">
            
              <b>hour</b>()
            
            <a href="Numeric.html#method-i-hour" name="method-i-hour" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-hours">
            
              <b>hours</b>()
            
            <a href="Numeric.html#method-i-hours" name="method-i-hours" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-hour">hour</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-hours_source')" id="l_method-i-hours_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/numeric/time.rb#L44" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-hours_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/time.rb, line 44</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">hours</span>
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Duration</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span> * <span class="ruby-number">3600</span>, [[<span class="ruby-value">:seconds</span>, <span class="ruby-keyword">self</span> * <span class="ruby-number">3600</span>]])
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-html_safe-3F">
            
              <b>html_safe?</b>()
            
            <a href="Numeric.html#method-i-html_safe-3F" name="method-i-html_safe-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-html_safe-3F_source')" id="l_method-i-html_safe-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L78" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-html_safe-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 78</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">html_safe?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-kilobyte">
            
              <b>kilobyte</b>()
            
            <a href="Numeric.html#method-i-kilobyte" name="method-i-kilobyte" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-kilobytes">
            
              <b>kilobytes</b>()
            
            <a href="Numeric.html#method-i-kilobytes" name="method-i-kilobytes" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-kilobyte">kilobyte</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-kilobytes_source')" id="l_method-i-kilobytes_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9eeb5fed2ff8e781e56202f62b125bfadc486999/activesupport/lib/active_support/core_ext/numeric/bytes.rb#L15" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-kilobytes_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 15</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">kilobytes</span>
  <span class="ruby-keyword">self</span> * <span class="ruby-constant">KILOBYTE</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-megabyte">
            
              <b>megabyte</b>()
            
            <a href="Numeric.html#method-i-megabyte" name="method-i-megabyte" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-megabytes">
            
              <b>megabytes</b>()
            
            <a href="Numeric.html#method-i-megabytes" name="method-i-megabytes" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-megabyte">megabyte</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-megabytes_source')" id="l_method-i-megabytes_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9eeb5fed2ff8e781e56202f62b125bfadc486999/activesupport/lib/active_support/core_ext/numeric/bytes.rb#L20" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-megabytes_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 20</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">megabytes</span>
  <span class="ruby-keyword">self</span> * <span class="ruby-constant">MEGABYTE</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-minute">
            
              <b>minute</b>()
            
            <a href="Numeric.html#method-i-minute" name="method-i-minute" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-minutes">
            
              <b>minutes</b>()
            
            <a href="Numeric.html#method-i-minutes" name="method-i-minutes" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-minute">minute</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-minutes_source')" id="l_method-i-minutes_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/numeric/time.rb#L39" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-minutes_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/time.rb, line 39</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">minutes</span>
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Duration</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span> * <span class="ruby-number">60</span>, [[<span class="ruby-value">:seconds</span>, <span class="ruby-keyword">self</span> * <span class="ruby-number">60</span>]])
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-petabyte">
            
              <b>petabyte</b>()
            
            <a href="Numeric.html#method-i-petabyte" name="method-i-petabyte" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-petabytes">
            
              <b>petabytes</b>()
            
            <a href="Numeric.html#method-i-petabytes" name="method-i-petabytes" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-petabyte">petabyte</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-petabytes_source')" id="l_method-i-petabytes_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9eeb5fed2ff8e781e56202f62b125bfadc486999/activesupport/lib/active_support/core_ext/numeric/bytes.rb#L35" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-petabytes_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">petabytes</span>
  <span class="ruby-keyword">self</span> * <span class="ruby-constant">PETABYTE</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-second">
            
              <b>second</b>()
            
            <a href="Numeric.html#method-i-second" name="method-i-second" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-seconds">
            
              <b>seconds</b>()
            
            <a href="Numeric.html#method-i-seconds" name="method-i-seconds" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Enables the use of time calculations and declarations, like 45.minutes +
2.hours + 4.years.</p>

<p>These methods use <a href="Time.html#method-i-advance">Time#advance</a> for
precise date calculations when using <a
href="Numeric.html#method-i-from_now">#from_now</a>, ago, etc. as well as
adding or subtracting their results from a <a href="Time.html">Time</a>
object. For example:</p>

<pre># equivalent to Time.current.advance(months: 1)
1.month.from_now

# equivalent to Time.current.advance(years: 2)
2.years.from_now

# equivalent to Time.current.advance(months: 4, years: 5)
(4.months + 5.years).from_now</pre>

<p>While these methods provide precise calculation when used as in the
examples above, care should be taken to note that this is not true if the
result of `months’, `years’, etc is converted before use:</p>

<pre># equivalent to 30.days.to_i.from_now
1.month.to_i.from_now

# equivalent to 365.25.days.to_f.from_now
1.year.to_f.from_now</pre>

<p>In such cases, Ruby’s core <a
href="http://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html">Date</a> and
<a href="http://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html">Time</a>
should be used for precision date and time arithmetic.</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-second">second</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-seconds_source')" id="l_method-i-seconds_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/numeric/time.rb#L34" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-seconds_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/time.rb, line 34</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">seconds</span>
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Duration</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, [[<span class="ruby-value">:seconds</span>, <span class="ruby-keyword">self</span>]])
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-since">
            
              <b>since</b>(time = ::Time.current)
            
            <a href="Numeric.html#method-i-since" name="method-i-since" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Reads best with argument:  10.minutes.since(time)</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-from_now">from_now</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-since_source')" id="l_method-i-since_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/numeric/time.rb#L73" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-since_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/time.rb, line 73</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">since</span>(<span class="ruby-identifier">time</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">current</span>)
  <span class="ruby-identifier">time</span> <span class="ruby-operator">+</span> <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-terabyte">
            
              <b>terabyte</b>()
            
            <a href="Numeric.html#method-i-terabyte" name="method-i-terabyte" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-terabytes">
            
              <b>terabytes</b>()
            
            <a href="Numeric.html#method-i-terabytes" name="method-i-terabytes" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-terabyte">terabyte</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-terabytes_source')" id="l_method-i-terabytes_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9eeb5fed2ff8e781e56202f62b125bfadc486999/activesupport/lib/active_support/core_ext/numeric/bytes.rb#L30" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-terabytes_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">terabytes</span>
  <span class="ruby-keyword">self</span> * <span class="ruby-constant">TERABYTE</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_formatted_s">
            
              <b>to_formatted_s</b>(format = :default, options = {})
            
            <a href="Numeric.html#method-i-to_formatted_s" name="method-i-to_formatted_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Provides options for converting numbers into formatted strings. Options are
provided for phone numbers, currency, percentage, precision, positional
notation, file size and pretty printing.</p>

<h4 id="method-i-to_formatted_s-label-Options">Options</h4>

<p>For details on which formats use which options, see <a
href="ActiveSupport/NumberHelper.html">ActiveSupport::NumberHelper</a></p>

<h4 id="method-i-to_formatted_s-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-constant">Phone</span> <span class="ruby-constant">Numbers</span><span class="ruby-operator">:</span>
<span class="ruby-value">5551234</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">phone</span>)                                     <span class="ruby-comment"># =&gt; 555-1234</span>
<span class="ruby-value">1235551234</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">phone</span>)                                  <span class="ruby-comment"># =&gt; 123-555-1234</span>
<span class="ruby-value">1235551234</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">phone</span>, <span class="ruby-identifier">area_code</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>)                 <span class="ruby-comment"># =&gt; (123) 555-1234</span>
<span class="ruby-value">1235551234</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">phone</span>, <span class="ruby-identifier">delimiter</span><span class="ruby-operator">:</span> <span class="ruby-string">' '</span>)                  <span class="ruby-comment"># =&gt; 123 555 1234</span>
<span class="ruby-value">1235551234</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">phone</span>, <span class="ruby-identifier">area_code</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">extension</span><span class="ruby-operator">:</span> <span class="ruby-value">555</span>) <span class="ruby-comment"># =&gt; (123) 555-1234 x 555</span>
<span class="ruby-value">1235551234</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">phone</span>, <span class="ruby-identifier">country_code</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>)                 <span class="ruby-comment"># =&gt; +1-123-555-1234</span>
<span class="ruby-value">1235551234</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">phone</span>, <span class="ruby-identifier">country_code</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">extension</span><span class="ruby-operator">:</span> <span class="ruby-value">1343</span>, <span class="ruby-identifier">delimiter</span><span class="ruby-operator">:</span> <span class="ruby-string">'.'</span>)
<span class="ruby-comment"># =&gt; +1.123.555.1234 x 1343</span>

<span class="ruby-constant">Currency</span><span class="ruby-operator">:</span>
<span class="ruby-value">1234567890.50</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">currency</span>)                 <span class="ruby-comment"># =&gt; $1,234,567,890.50</span>
<span class="ruby-value">1234567890.506</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">currency</span>)                <span class="ruby-comment"># =&gt; $1,234,567,890.51</span>
<span class="ruby-value">1234567890.506</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">currency</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">3</span>)  <span class="ruby-comment"># =&gt; $1,234,567,890.506</span>
<span class="ruby-value">1234567890.506</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">currency</span>, <span class="ruby-identifier">locale</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">fr</span>)   <span class="ruby-comment"># =&gt; 1 234 567 890,51 €</span>
<span class="ruby-value">-1234567890.50</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">currency</span>, <span class="ruby-identifier">negative_format</span><span class="ruby-operator">:</span> <span class="ruby-string">'(%u%n)'</span>)
<span class="ruby-comment"># =&gt; ($1,234,567,890.50)</span>
<span class="ruby-value">1234567890.50</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">currency</span>, <span class="ruby-identifier">unit</span><span class="ruby-operator">:</span> <span class="ruby-string">'&amp;pound;'</span>, <span class="ruby-identifier">separator</span><span class="ruby-operator">:</span> <span class="ruby-string">','</span>, <span class="ruby-identifier">delimiter</span><span class="ruby-operator">:</span> <span class="ruby-string">''</span>)
<span class="ruby-comment"># =&gt; &amp;pound;1234567890,50</span>
<span class="ruby-value">1234567890.50</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">currency</span>, <span class="ruby-identifier">unit</span><span class="ruby-operator">:</span> <span class="ruby-string">'&amp;pound;'</span>, <span class="ruby-identifier">separator</span><span class="ruby-operator">:</span> <span class="ruby-string">','</span>, <span class="ruby-identifier">delimiter</span><span class="ruby-operator">:</span> <span class="ruby-string">''</span>, <span class="ruby-identifier">format</span><span class="ruby-operator">:</span> <span class="ruby-string">'%n %u'</span>)
<span class="ruby-comment"># =&gt; 1234567890,50 &amp;pound;</span>

<span class="ruby-constant">Percentage</span><span class="ruby-operator">:</span>
<span class="ruby-value">100</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">percentage</span>)                                  <span class="ruby-comment"># =&gt; 100.000%</span>
<span class="ruby-value">100</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">percentage</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">0</span>)                    <span class="ruby-comment"># =&gt; 100%</span>
<span class="ruby-value">1000</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">percentage</span>, <span class="ruby-identifier">delimiter</span><span class="ruby-operator">:</span> <span class="ruby-string">'.'</span>, <span class="ruby-identifier">separator</span><span class="ruby-operator">:</span> <span class="ruby-string">','</span>) <span class="ruby-comment"># =&gt; 1.000,000%</span>
<span class="ruby-value">302.24398923423</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">percentage</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">5</span>)        <span class="ruby-comment"># =&gt; 302.24399%</span>
<span class="ruby-value">1000</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">percentage</span>, <span class="ruby-identifier">locale</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">fr</span>)                    <span class="ruby-comment"># =&gt; 1 000,000%</span>
<span class="ruby-value">100</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">percentage</span>, <span class="ruby-identifier">format</span><span class="ruby-operator">:</span> <span class="ruby-string">'%n  %'</span>)                 <span class="ruby-comment"># =&gt; 100  %</span>

<span class="ruby-constant">Delimited</span><span class="ruby-operator">:</span>
<span class="ruby-value">12345678</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">delimited</span>)                     <span class="ruby-comment"># =&gt; 12,345,678</span>
<span class="ruby-value">12345678.05</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">delimited</span>)                  <span class="ruby-comment"># =&gt; 12,345,678.05</span>
<span class="ruby-value">12345678</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">delimited</span>, <span class="ruby-identifier">delimiter</span><span class="ruby-operator">:</span> <span class="ruby-string">'.'</span>)     <span class="ruby-comment"># =&gt; 12.345.678</span>
<span class="ruby-value">12345678</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">delimited</span>, <span class="ruby-identifier">delimiter</span><span class="ruby-operator">:</span> <span class="ruby-string">','</span>)     <span class="ruby-comment"># =&gt; 12,345,678</span>
<span class="ruby-value">12345678.05</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">delimited</span>, <span class="ruby-identifier">separator</span><span class="ruby-operator">:</span> <span class="ruby-string">' '</span>)  <span class="ruby-comment"># =&gt; 12,345,678 05</span>
<span class="ruby-value">12345678.05</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">delimited</span>, <span class="ruby-identifier">locale</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">fr</span>)     <span class="ruby-comment"># =&gt; 12 345 678,05</span>
<span class="ruby-value">98765432.98</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">delimited</span>, <span class="ruby-identifier">delimiter</span><span class="ruby-operator">:</span> <span class="ruby-string">' '</span>, <span class="ruby-identifier">separator</span><span class="ruby-operator">:</span> <span class="ruby-string">','</span>)
<span class="ruby-comment"># =&gt; 98 765 432,98</span>

<span class="ruby-constant">Rounded</span><span class="ruby-operator">:</span>
<span class="ruby-value">111.2345</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">rounded</span>)                                      <span class="ruby-comment"># =&gt; 111.235</span>
<span class="ruby-value">111.2345</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">rounded</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">2</span>)                        <span class="ruby-comment"># =&gt; 111.23</span>
<span class="ruby-value">13</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">rounded</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">5</span>)                              <span class="ruby-comment"># =&gt; 13.00000</span>
<span class="ruby-value">389.32314</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">rounded</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">0</span>)                       <span class="ruby-comment"># =&gt; 389</span>
<span class="ruby-value">111.2345</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">rounded</span>, <span class="ruby-identifier">significant</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>)                   <span class="ruby-comment"># =&gt; 111</span>
<span class="ruby-value">111.2345</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">rounded</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">significant</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>)     <span class="ruby-comment"># =&gt; 100</span>
<span class="ruby-value">13</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">rounded</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">5</span>, <span class="ruby-identifier">significant</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>)           <span class="ruby-comment"># =&gt; 13.000</span>
<span class="ruby-value">111.234</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">rounded</span>, <span class="ruby-identifier">locale</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">fr</span>)                          <span class="ruby-comment"># =&gt; 111,234</span>
<span class="ruby-value">13</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">rounded</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">5</span>, <span class="ruby-identifier">significant</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">strip_insignificant_zeros</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>)
<span class="ruby-comment"># =&gt; 13</span>
<span class="ruby-value">389.32314</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">rounded</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">4</span>, <span class="ruby-identifier">significant</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>)    <span class="ruby-comment"># =&gt; 389.3</span>
<span class="ruby-value">1111.2345</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">rounded</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">2</span>, <span class="ruby-identifier">separator</span><span class="ruby-operator">:</span> <span class="ruby-string">','</span>, <span class="ruby-identifier">delimiter</span><span class="ruby-operator">:</span> <span class="ruby-string">'.'</span>)
<span class="ruby-comment"># =&gt; 1.111,23</span>

<span class="ruby-constant">Human</span><span class="ruby-operator">-</span><span class="ruby-identifier">friendly</span> <span class="ruby-identifier">size</span> <span class="ruby-keyword">in</span> <span class="ruby-constant">Bytes</span><span class="ruby-operator">:</span>
<span class="ruby-value">123</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human_size</span>)                                   <span class="ruby-comment"># =&gt; 123 Bytes</span>
<span class="ruby-value">1234</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human_size</span>)                                  <span class="ruby-comment"># =&gt; 1.21 KB</span>
<span class="ruby-value">12345</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human_size</span>)                                 <span class="ruby-comment"># =&gt; 12.1 KB</span>
<span class="ruby-value">1234567</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human_size</span>)                               <span class="ruby-comment"># =&gt; 1.18 MB</span>
<span class="ruby-value">1234567890</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human_size</span>)                            <span class="ruby-comment"># =&gt; 1.15 GB</span>
<span class="ruby-value">1234567890123</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human_size</span>)                         <span class="ruby-comment"># =&gt; 1.12 TB</span>
<span class="ruby-value">1234567</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human_size</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">2</span>)                 <span class="ruby-comment"># =&gt; 1.2 MB</span>
<span class="ruby-value">483989</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human_size</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">2</span>)                  <span class="ruby-comment"># =&gt; 470 KB</span>
<span class="ruby-value">1234567</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human_size</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">2</span>, <span class="ruby-identifier">separator</span><span class="ruby-operator">:</span> <span class="ruby-string">','</span>) <span class="ruby-comment"># =&gt; 1,2 MB</span>
<span class="ruby-value">1234567890123</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human_size</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">5</span>)           <span class="ruby-comment"># =&gt; &quot;1.1229 TB&quot;</span>
<span class="ruby-value">524288000</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human_size</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">5</span>)               <span class="ruby-comment"># =&gt; &quot;500 MB&quot;</span>

<span class="ruby-constant">Human</span><span class="ruby-operator">-</span><span class="ruby-identifier">friendly</span> <span class="ruby-identifier">format</span><span class="ruby-operator">:</span>
<span class="ruby-value">123</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>)                                       <span class="ruby-comment"># =&gt; &quot;123&quot;</span>
<span class="ruby-value">1234</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>)                                      <span class="ruby-comment"># =&gt; &quot;1.23 Thousand&quot;</span>
<span class="ruby-value">12345</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>)                                     <span class="ruby-comment"># =&gt; &quot;12.3 Thousand&quot;</span>
<span class="ruby-value">1234567</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>)                                   <span class="ruby-comment"># =&gt; &quot;1.23 Million&quot;</span>
<span class="ruby-value">1234567890</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>)                                <span class="ruby-comment"># =&gt; &quot;1.23 Billion&quot;</span>
<span class="ruby-value">1234567890123</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>)                             <span class="ruby-comment"># =&gt; &quot;1.23 Trillion&quot;</span>
<span class="ruby-value">1234567890123456</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>)                          <span class="ruby-comment"># =&gt; &quot;1.23 Quadrillion&quot;</span>
<span class="ruby-value">1234567890123456789</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>)                       <span class="ruby-comment"># =&gt; &quot;1230 Quadrillion&quot;</span>
<span class="ruby-value">489939</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">2</span>)                      <span class="ruby-comment"># =&gt; &quot;490 Thousand&quot;</span>
<span class="ruby-value">489939</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">4</span>)                      <span class="ruby-comment"># =&gt; &quot;489.9 Thousand&quot;</span>
<span class="ruby-value">1234567</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">4</span>,
                 <span class="ruby-identifier">significant</span><span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>)                   <span class="ruby-comment"># =&gt; &quot;1.2346 Million&quot;</span>
<span class="ruby-value">1234567</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">human</span>, <span class="ruby-identifier">precision</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>,
                 <span class="ruby-identifier">separator</span><span class="ruby-operator">:</span> <span class="ruby-string">','</span>,
                 <span class="ruby-identifier">significant</span><span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>)                   <span class="ruby-comment"># =&gt; &quot;1,2 Million&quot;</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_formatted_s_source')" id="l_method-i-to_formatted_s_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/numeric/conversions.rb#L100" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_formatted_s_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/conversions.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_formatted_s</span>(<span class="ruby-identifier">format</span> = <span class="ruby-value">:default</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">format</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:phone</span>
    <span class="ruby-keyword">return</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">NumberHelper</span>.<span class="ruby-identifier">number_to_phone</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:currency</span>
    <span class="ruby-keyword">return</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">NumberHelper</span>.<span class="ruby-identifier">number_to_currency</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:percentage</span>
    <span class="ruby-keyword">return</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">NumberHelper</span>.<span class="ruby-identifier">number_to_percentage</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:delimited</span>
    <span class="ruby-keyword">return</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">NumberHelper</span>.<span class="ruby-identifier">number_to_delimited</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:rounded</span>
    <span class="ruby-keyword">return</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">NumberHelper</span>.<span class="ruby-identifier">number_to_rounded</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:human</span>
    <span class="ruby-keyword">return</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">NumberHelper</span>.<span class="ruby-identifier">number_to_human</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:human_size</span>
    <span class="ruby-keyword">return</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">NumberHelper</span>.<span class="ruby-identifier">number_to_human_size</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">to_default_s</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-until">
            
              <b>until</b>(time = ::Time.current)
            
            <a href="Numeric.html#method-i-until" name="method-i-until" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Reads best with argument:  10.minutes.until(time)</p>
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-week">
            
              <b>week</b>()
            
            <a href="Numeric.html#method-i-week" name="method-i-week" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-weeks">
            
              <b>weeks</b>()
            
            <a href="Numeric.html#method-i-weeks" name="method-i-weeks" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Numeric.html#method-i-week">week</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-weeks_source')" id="l_method-i-weeks_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/numeric/time.rb#L54" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-weeks_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/numeric/time.rb, line 54</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">weeks</span>
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Duration</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span> * <span class="ruby-number">7</span>.<span class="ruby-identifier">days</span>, [[<span class="ruby-value">:days</span>, <span class="ruby-keyword">self</span> * <span class="ruby-number">7</span>]])
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    